<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="../css/bootstrap.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<div style="width: 600px; margin: 0 auto;">
    <form id="loginForm" method="post" onsubmit="return false;">
        <h1>Login</h1>
        <hr/>
        <div class="form-group">
            <label for="username">Phone Number:</label>
            <input type="text" class="form-control" id="username" name="cs_name" placeholder="Input phone number here."/>
        </div>
        <div class="form-group">
            <label for="password">Password:</label>
            <input type="password" class="form-control" id="password" name="cs_password" placeholder="Input password here."/>
        </div>
        <div class="form-group">
            <button id="login-btn" class="btn btn-sm btn-success">Login</button>
        </div>
    </form>
</div>
<script src="../js/jquery-3.2.1.min.js"></script>
<script>
    $("#login-btn").click(function () {
        console.log($("#loginForm").serialize());
        $.post("/cs/login", $("#loginForm").serialize(), function (result) {
            if (result.status) {
                window.location.href = "/cs/chat";
            }
            else {
                alert(result);
            }
        });
    });
</script>
</body>
</html>